package com.bolt.support.spring.jpa.jpql;

import java.util.Locale;

public enum SqlOrder {

    /**
     * Ascending order
     */
    ASC,
    /**
     * Descending order
     */
    DESC;

    public static SqlOrder fromString(String value) {

        try {
            return SqlOrder.valueOf(value.toUpperCase(Locale.US));
        } catch (Exception e) {
            throw new IllegalArgumentException(String.format(
                    "Invalid value '%s' for orders given! Has to be either 'desc' or 'asc'", value), e);
        }
    }
}

 